<template>
  <div id="changedialog">
    <commonformdialog
      :isshowDialogs="isshowDialog"
      :dialogTitle="dialogTitle"
      @closetextDialog="closetextDialog"
      @confirmbtn="confirmbtn"
      @rejected="rejected"
      :isshowFooter="false"
      :isshowFooterBh="isshowFooterBh"
    >
      <div class="innerLoding">
        <el-row>
          <el-form
            :model="formData"
            ref="ruleForm"
            label-width="120px"
            size="small"
          >
            <el-col :span="24">
              <h3 class="titleTips">
                审核信息：<span class="look">{{ formData.statusText }}</span>
              </h3>
            </el-col>
              <el-col :span="12">
              <el-form-item label="封面图:" prop="head_img">
                <el-image
                  style="width: 100px; height: 100px"
                  :src="formData.head_img"
                  :preview-src-list="[formData.head_img]"
                   :zIndex='9999'
                >
                </el-image>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="详情图:" prop="picture">
                <el-image
                  style="width: 100px; height: 100px"
                  :src="formData.picture"
                  :preview-src-list="[formData.picture]"
                   :zIndex='9999'
                >
                </el-image>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="名称:" prop="title">
                <span>{{ formData.title }}</span>
              </el-form-item>
            </el-col>
           
            <el-col :span="12">
              <el-form-item label="驾校:" prop="school_id">
                <span>{{ formData.school_id }}</span>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="联系人:" prop="userName">
                <span>{{ formData.userName }}</span>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="联系电话:" prop="userTel">
                <span>{{ formData.userTel }}</span>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="城市:" prop="city">
                <span>{{ formData.city }}</span>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="经营方式:" prop="is_partner">
                <span>{{ formData.is_partner }}</span>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="服务网点:" prop="is_branch">
                <span>{{ formData.is_branch }}</span>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="基础设施:" prop="facilities">
                <span>{{ formData.facilities }}</span>
              </el-form-item>
            </el-col>
           
            <el-col :span="24">
              <el-form-item label="详细地址:" prop="address">
                <span>{{ formData.address }}</span>
              </el-form-item>
            </el-col>
            <el-col :span="24">
              <el-form-item label="">
                <div class="mapBox">
                  <showMap :mapData="mapData"></showMap>
                </div>
              </el-form-item>
            </el-col>
          </el-form>
        </el-row>
      </div>
      <toExamine
        :isshowDialogE="isshowDialogE"
        :status="status"
        :id="id"
        @closedialogE="closeDialogE"
        @confirmbtnE="confirmbtnE"
      ></toExamine>
    </commonformdialog>
  </div>
</template>

<script type="text/javascript">
//引入弹窗
import commonformdialog from "@/components/commondialog/commondialog";
import showMap from "@/components/showMap";
import toExamine from "./toExamine";

export default {
  data() {
    return {
      formData: {},
      isshowFooterBh: false,
      isshowDialogE: false,
      status: null,
      id: null,
      mapData: {},
    };
  },
  props: {
    //是否显示弹窗
    isshowDialog: {
      type: Boolean,
      default: false,
      required: true,
    },
    //表单的名字
    dialogTitle: {
      type: String,
      default: "",
      required: true,
    },
    //是编辑还是新增
    formType: {
      type: Number,
      default: 0,
    },
    dialogdata: {
      type: Object,
    },
  },
  components: {
    commonformdialog,
    toExamine,
    showMap,
  },
  methods: {
    closetextDialog() {
      this.$emit("closedialog");
    },
    //关闭审核弹框
    closeDialogE() {
      this.isshowDialogE = false;
    },
    //提交审核
    confirmbtnE() {
      this.isshowDialogE = false;
      //通知父级关闭弹框
      console.log("审核提交");
      this.$emit("confirm");
    },
    //驳回
    rejected() {
      this.status = 2;
      this.id = this.formData.id;
      this.isshowDialogE = true;
    },
    //通过
    confirmbtn() {
      this.status = 1;
      this.id = this.formData.id;
      this.isshowDialogE = true;
    },
  },
  watch: {
    isshowDialog: function (val) {
      if (!val) {
        this.$refs["ruleForm"].resetFields();
      }
    },
    dialogdata: function (val) {
      if (val) {
        this.$nextTick(() => {
          this.formData = val;
          let mapData = {};
          mapData.lat = this.formData.lat;
          mapData.lng = this.formData.lng;
          mapData.address = this.formData.address;
          this.mapData = mapData;
        });
      }
    },
    formType: function (val) {
      if (val === 0) {
        this.isshowFooterBh = false;
      } else {
        this.isshowFooterBh = true;
      }
    },
  },
  created() {},
};
</script>

<style lang="scss" scoped>

.mapBox{
  position: relative;height: 500px;
}
</style>
